package com.lefevre.cms.web.action.user;

import com.lefevre.cms.bean.RequestResult;
import com.lefevre.cms.bean.ResultCode;
import com.lefevre.cms.bean.user.UserCustom;
import com.lefevre.cms.service.user.UserCustomService;
import com.lefevre.cms.utils.JsonUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 用户自定义注册功能项
 */
@Controller
public class UserCustomAction {

    @Resource(name = "userCustomServiceBean")
    private UserCustomService userCustomService;

    @ResponseBody
    @RequestMapping("/control/userCustom/list")
    public String execute(
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        List<UserCustom> userCustom = userCustomService.findAllUserCustom();

        return JsonUtils.toJSONString(new RequestResult(ResultCode.SUCCESS, userCustom));
    }


}
